package com.daguchuangyi.erp_android.production_detail;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lijianjian on 2018/3/11.
 */

public class ContentPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> mFragments;
    private String[] mTitles = new String[3];

    public void bindData(List<Fragment> fragments, String[] titles) {

//        mFragments.add(new ProductImageFragment());
//        mFragments.add(new ShelfFragment());
//        mFragments.add(new StockInfoFragment());
        mFragments.clear();
        mFragments.addAll(fragments);
        mTitles = titles;

//        mTitles[0] = "商品图片(29)";
//        mTitles[1] = "样品库(12)";
//        mTitles[2] = "仓储(2)";
        notifyDataSetChanged();
    }


    public ContentPagerAdapter(FragmentManager fm) {
        super(fm);
        mFragments = new ArrayList<>();
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    public String[] getTitles() {
        return mTitles;
    }
}
